{include file='public:header-css'/}
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    {include file='public:left-menu'/}
    <!--End 左侧导航-->
    <!--头部信息-->
    {include file='public:nav-header' title="订单管理" subTitle="进货订单列表"/}
    <!--End 头部信息-->

    <!--页面主要内容-->
    <main class="lyear-layout-content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              {assign name="order_status" value="$Request.param.order_status|default='0'" /}
              <ul class="nav nav-tabs page-tabs">
                <li {if $order_status=='0'}class="active"{/if}><a href="{:url('Order/stock_index',['order_status'=>'0'])}">全部</a></li>
                <li {if $order_status=='1'}class="active"{/if}><a href="{:url('Order/stock_index',['order_status'=>'1'])}">待发货</a></li>
                <li {if $order_status=='2'}class="active"{/if}><a href="{:url('Order/stock_index',['order_status'=>'2'])}">待收货</a></li>
                <li {if $order_status=='3'}class="active"{/if}><a href="{:url('Order/stock_index',['order_status'=>'3'])}">已完成</a></li>
              </ul>
              <div class="hint">
                <div class="hint-info">
                  <h5><i class="mdi mdi-help-circle-outline"></i>操作提示</h5>
                  <p>平台所有进货订单列表</p>
                </div>
              </div>
              <div class="card-toolbar">
                <div class="toolbar-btn-action">
                  <a class="btn btn-label btn-theme" onclick="submit(2)" href="javascript:;"><label><i
                          class="mdi mdi-buffer"></i></label> 导出数据</a>
                </div>
                <div class="card-toolbar-center">
                  <a href="" class="table-btn btn-dark"><i class="mdi mdi-replay"></i></a>
                  <button class="table-btn btn-theme">共{$list->total()}条记录 当前第{$list->currentPage()}页</button>
                </div>
                <form class="table-form" method="post" action="">
                  <input type="hidden" name="order_ids">
                  <div class="table-form-group">
                    <input data-type="time" readonly id="start_time" name="start_time" type="text" value="{$start_time}">
                    <button class="btn btn-default" type="button">开始时间</button>
                  </div>
                  <div class="table-form-group">
                    <input data-type="time" name="end_time" id="end_time" type="text" value="{$end_time}" readonly>
                    <button class="btn btn-default" type="button">结束时间</button>
                  </div>
                  <div class="table-form-group">
                    <select name="key_type" class="input-group-select">
                        <option value="mobile" {if $Request.param.key_type=='mobile'}selected{/if}>手机号码</option>
                        <option value="realname" {if $Request.param.key_type=='realname'}selected{/if}>真实姓名</option>
                      <option value="order_sn" {if $Request.param.key_type=='order_sn'}selected{/if}>订单编号</option>
                    </select>
                    <input type="text" value="{$Request.param.keyword}" name="keyword" placeholder="查询相关数据">
                    <button class="btn btn-default" onclick="submit(1)" type="button">搜索</button>
                  </div>
                </form>
              </div>
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-bordered table-striped table-hover">
                    <thead>
                    <tr>
                      <th>
                        <label class="table-checkbox">
                          <input type="checkbox" id="check-all"><span></span>
                        </label>
                      </th>
                      <th style="width: 110px">操作</th>
                      <th>会员手机</th>
                      <th>真实姓名</th>
                      <th>订单编号</th>
                      <th>商品名称</th>
                      <th colspan="2">收货人</th>
                      <th>支付方式</th>
                      <th>订单总额</th>
                      <th>应付总额</th>
                      <th>订单状态</th>
                      <th>创建时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {if $list->isEmpty()}
                    <tr>
                      <td class="no-data" colspan="50">
                        <i class="mdi mdi-alert-decagram"></i>没有符合条件的记录
                      </td>
                    </tr>
                    {else/}
                    {volist name="$list" id="vo"}
                    <tr>
                      <td>
                        <label class="table-checkbox">
                          <input type="checkbox" class="checkbox"
                                 value="{$vo[$vo.pk]}"><span></span>
                        </label>
                      </td>
                      <td><a class="table-btn btn-theme" href="{:url('Order/stock_order_detail',['order_id'=>$vo[$vo.pk]])}"><i class="mdi mdi-pencil"></i>查看详情</a>
                      <td><a href="{:url('User/detail',['user_id'=>$vo.user.user_id])}">{$vo.user.mobile}</a></td>
                      <td>{$vo.user.realname|default='无'}</td>
                      <td>{$vo.order_sn}</td>
                      <td>{$vo.goods_name}</td>
                      <td>{if $vo.consignee && $vo.mobile}{$vo.consignee_text}{else/}---{/if}</td>
                      <td>{if $vo.province && $vo.city && $vo.district}{$vo.province}{$vo.city}{$vo.district}{else/}---{/if}</td>
                      <td>{$vo.pay_name|default='---'}</td>
                      <td>{$vo.total_amount}</td>
                      <td>{$vo.order_amount}</td>
                      <td>{$vo.order_status_text}</td>
                      <td>{$vo.add_time}</td>
                    </tr>
                    {/volist}
                    {/if}
                    </tbody>
                  </table>
                </div>
                <!--分页-->
                <div class="page">
                  {$page|raw}
                </div>
              </div>
            </div>
          </div>

        </div>

      </div>

    </main>
    <!--End 页面主要内容-->
  </div>
</div>
<style>

</style>
<!--日期选择插件-->
<script src="__STATIC__/plugin/laydate/laydate/laydate.js"></script>
<script type="text/javascript">
  $(function(){
    $('#start_time').layDate();
    $('#end_time').layDate();
  });
  //回车提交
  $(document).keyup(function(event){
    if(event.keyCode ==13){
      submit(1);
    }
  });
  function submit(type) {
    if (type==1){
      $('[name=order_ids]').val('');
      var url="{:url('Order/stock_index')}";
    }else {
      var checkbox = $('.checkbox:checked');
      var ids = [];
      $.each(checkbox, function (index, item) {
        ids.push(item.value)
      });
      $('[name=order_ids]').val(ids);
      var url="{:url('Order/export_stock_order')}";
    }
    $('.table-form').attr('action',url).submit();
  }
</script>
</body>
</html>
